/*********************************************************************************
 *      Copyright:  (C) 2022 Li Yanting<liyanting2@163.com>
 *                  All rights reserved.
 *
 *       Filename:  switch.c
 *    Description:  This file 
 *                 
 *        Version:  1.0.0(07/06/2022)
 *         Author:  Li Yanting <liyanting2@163.com>
 *      ChangeLog:  1, Release initial version on "07/06/2022 09:23:30"
 *                 
 ********************************************************************************/
#include "switch.h"

int switch_led(int cmd)
{
    if(wiringPiSetup() < 0)
    {
        printf("swicth init failure.\n");
        return -1;
    }

    pinMode(GPIO_LED, OUTPUT);
    digitalWrite(GPIO_LED, HIGH);

    if(1 == cmd)
    {
        digitalWrite(GPIO_LED, LOW);
    }
    else if(0 == cmd)
    {
        digitalWrite(GPIO_LED, HIGH);
    }
    
    return 0;
}